/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.ui.rich.full.dialogs;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;

import javax.swing.JComboBox;
import javax.swing.JPanel;

import br.ufmg.dees.insane.commons.dialogs.SimpleDialog;
import br.ufmg.dees.insane.ui.rich.full.InsaneInternalInterface;

/**
*
* @author Moreira, Renata & Pitangueira, Roque
* @since August 2005
*/
public class ElmGaussPointDialog extends SimpleDialog {
	
	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;
	private InsaneInternalInterface parent;
	private String[] analysisTypeStr;
	private JComboBox analysisTypeCombo;
	public String anlTypeChosen;
	
	
	/**
	 * Constructor method, calling super with the especific title.
	 *
	 * @param parent The parent of the class.
	 * @see gui.InsaneInternalInterface
	 */
	public ElmGaussPointDialog(InsaneInternalInterface parent) {
		this.parent = parent;
		
			analysisTypeStr = new String[6];
			analysisTypeStr[0] = "1 " + parent.getResourceBundle().getString("dElmGaussPtDialog01");
			analysisTypeStr[1] = "2 " + parent.getResourceBundle().getString("dElmGaussPtDialog02");
			analysisTypeStr[2] = "3 " + parent.getResourceBundle().getString("dElmGaussPtDialog02");
			analysisTypeStr[3] = "4 " + parent.getResourceBundle().getString("dElmGaussPtDialog02");
			analysisTypeStr[4] = "5 " + parent.getResourceBundle().getString("dElmGaussPtDialog02");
			analysisTypeStr[5] = "6 " + parent.getResourceBundle().getString("dElmGaussPtDialog02");
		
		analysisTypeCombo = new JComboBox(analysisTypeStr);
		//setUpFields();
		
		JPanel mainPane = new JPanel();
		mainPane.setPreferredSize(new Dimension(200,35));
		mainPane.setLayout(new GridLayout(1,1,2,2));
		analysisTypeCombo.setPreferredSize(new Dimension (180,26));
		JPanel subPane = new JPanel();
		subPane.add(analysisTypeCombo);
		mainPane.add(subPane);
		
		setPane(mainPane);
		
    }
	
//*****************************************************************************
	
    public int showDialog() {
        return super.showDialog(parent, parent.getResourceBundle().getString("dElmGaussPtDialog03"));
    }
	
//*****************************************************************************
	
	/**
	 * This method is executed on OK button click.
	 */
	public void approvedPerform() {
		
		try {
			int anlIndex = analysisTypeCombo.getSelectedIndex();
			anlTypeChosen = analysisTypeStr[anlIndex];
		} catch (Exception e) {
			Toolkit.getDefaultToolkit().beep();
			this.setVisible(false);
		}
	}
	

}

